class ReportesController < ApplicationController

  def index
    @active_section = Section.find_by_short_name("Reportes");
    @categories = Category.joins("right join accounts_categories on categories.id = accounts_categories.category_id").where("section_id = ? and account_id = ? and parent_category_id is null",@active_section.id,@current_account.id)
    if @categories
      @categories.each do |category|
        if category.category_type == 'standard' || category.category_type == 'standard-title' || category.category_type == 'subheader'
          @active_category = category
          @active_subcategory_ordinaria = @active_category.subcategories.first
          @active_subcategory_extraordinaria = @active_category.subcategories.last
          @active_category_id = category.id
          break
        end
      end
      @has_active_categories = @categories.count > 0
      @ordinarias = Category.where(:category_code_name => "ordinaria")
      @extraordinarias = Category.where(:category_code_name => "extraordinaria")  
    end
  end
  
end
